Exercise: Plotting Torus
In this lesson, you will be plotting a torus.
We'll cover the following
In geometry, a torus is a surface of revolution generated by revolving a circle in three-dimensional space about an axis that is coplanar with the circle.
A torus is defined by the following equation:
If you see the diagram above,
- and are angles which make a full circle so their values start and end at the same point:
- is the angle inside the cross-section of the tube and is in the plane.
- is the angle from one point on the torus to another point through the center and it lies in the plane.
- is the distance from the center of the tube to the center of the torus,
- is the radius of the tube.
The ratio is usually or .
Task#
In this exercise, you will plot tori with a different viewing axis and colormaps using surface plots.
Problem statement#
Define a function torus() with arguments r, R and angle.
torus() should return 3 arrays: x, y and z.
Plot two 3-D surface plots on the same figure with different axes. Set the values of arguments as you seem fit.
Set appropriate axis limits based on the dimensions of your torus.
Properties of First Plot
- colormap =
cool - elevation angle = 36
- azimuthal angle = 26
Properties of Second Plot
- colormap =
rainbow - elevation angle = 15
- azimuthal angle = 45
Use all the important modules needed.
A basic structure of the code is given below.
The solution to this exercise will be discussed in the next lesson.
Solution Review: Plotting Temperatures
Solution Review: Plotting Torus